<?php

namespace App\Transformers\Student;

use League\Fractal\TransformerAbstract;
use App\Models\Student\StudentRelation;

/**
 * Class StudentRelationTransformer
 * @package namespace App\Transformers\Student;
 */
class StudentRelationTransformer extends TransformerAbstract
{

    /**
     * Transform the \StudentRelation entity
     * @param \StudentRelation $model
     *
     * @return array
     */
    public function transform(StudentRelation $model)
    {
        return [
            'id'         => (int) $model->id,
            'student_id'    => (int) $model->student_id,
            'student_name'  =>  $model->student_name,
            'relation_name'  =>  $model->relation_name,
            'name'  =>  $model->name,
            'phone'  =>  $model->phone,
            'company'  =>  $model->company,
            'created_user' => $model->created_user,
            'updated_user' => $model->updated_user,
            'created_at' => $model->created_at->format('Y-m-d H:i:s'),
            'updated_at' => $model->updated_at->format('Y-m-d H:i:s')
        ];
    }
}
